package com.sugon.modules.todo.consts;

import cn.hutool.core.util.StrUtil;

/**
 * 待办事项来源
 *
 * @author YuXD
 * @since 2023/5/25
 */
public enum TodoSource {

    INSPECT("0", "INSPECTION_RECORDING_JOIN", "设备巡检"),
    REPAIR("1", "DEV_REPAIR_RECORD", "紧急维修/EM"),
    PM("2", "DEV_MAINTENANCE_TICKET", "预防维护/PM"),
    AM("3", "DEV_MAINTENANCE_TICKET_AM", "自主维护/AM"),
    FAULT_ANALYSE("4", "DEV_FAULT_PREVENT_MEASURE", "ICA/PCA改进措施");

    String exType;

    String value;

    String desc;

    TodoSource(String exType, String value, String desc) {
        this.exType = exType;
        this.value = value;
        this.desc = desc;
    }

    public String getExType() {
        return exType;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据value获取对应的枚举实例
     *
     * @param value
     * @return
     */
    public static TodoSource getInstanceByValue(String value) {
        TodoSource[] values = values();
        for (TodoSource todoSource : values) {
            if (StrUtil.equals(todoSource.getValue(), value)) {
                return todoSource;
            }
        }
        return null;
    }

}
